'use strict'

//切换到文件所在的目录
process.chdir(__dirname);

const Titbit = require('titbit');
const TitbitLoader = require('titbit-loader');

const {initORM} = require('psqlorm');
const dbconfig = require('./config/dbconfig.js');

const app = new Titbit({
    debug:true
});

let tbl = new TitbitLoader({
    // 要传递的数据库连接实例
    mdb: initORM(dbconfig.connect,dbconfig.schema)
});

//加载controller、model、middleware
tbl.init(app);

//使用指令创建控制器
//npx new-ctl login api/content

//创建model
//npx new-model content

//app.services -- 项目的资源池
app.addService('imagePath',__dirname+'/upload');
app.addService('aeskey',('7cbxsf6s789fsa0v530dfs27af156aiuoy671g8525sf4f6934sg8nc134juy12da3dsa902').substring(5,37));

app.run(8080);